#!/usr/bin/python
# -*- coding: utf8
__author__ = 'mkompan'

import sys

import cs_api


if len(sys.argv) == 2:
    cs_api._EC2_CONFIG = sys.argv[1]


offerings = cs_api.command(cs_api.EC2Command(command='listServiceOfferings'))

print 'listServiceOfferings'
for item in cs_api.response_body(offerings):
    print item['name'], item['id']

print
print 'listTemplates', 'featured'
templates = cs_api.command(cs_api.EC2Command(command='listTemplates', templatefilter='featured'))
for item in cs_api.response_body(templates):
    print item['name'], item['id']
print
print 'listTemplates', 'community'
templates = cs_api.command(cs_api.EC2Command(command='listTemplates', templatefilter='community'))
for item in cs_api.response_body(templates):
    print item['name'], item['id']


print
print 'listZones'
zones = cs_api.command(cs_api.EC2Command(command='listZones'))
for item in cs_api.response_body(zones):
    print item['name'], item['id']

print
print 'listDiskOfferings'
disk_offerings = cs_api.command(cs_api.EC2Command(command='listDiskOfferings'))
for item in cs_api.response_body(disk_offerings):
    print item['name'], item['id']

print
print 'listNetworks'
networks = cs_api.command(cs_api.EC2Command(command='listNetworks'))
for item in cs_api.response_body(networks):
    print item['name'], item['id']

print
print 'listSecurityGroups'
response = cs_api.command(cs_api.EC2Command(command='listSecurityGroups'))
for item in cs_api.response_body(response):
    print item['name'], item['id']

